package com.lx.dao;

import com.lx.entity.Order;
import com.lx.entity.OrderDetail;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

@Mapper
public interface OrderDao {
//    List<Order> selectAll(Map<String, Object> params);
    List<Order> selectAllOrder(Map<String, Object> params);
    List<OrderDetail> selectOrderDetailList(List<Integer> idList);
    //获取 用户 购物车的订单信息 - 最近的未支付的订单
    List<Order> selectOrderCarRecent(Integer id);
    Order selectOrderCarCreated(Integer id); //查询刚创建的购物车订单
    Order selectEasyOrderById(Integer id);
    //给用户新增一个空购物车order，isPay = -2表示购物车订单
    int insertOrder(Integer id);
    //修该购物车订单，完善购物车订单
    int updateOrderById(Order order);
    int updateOrderStatusBySerialNumber(@Param("serialNumber") String serialNumber, @Param("isPay") Integer isPay);
    int updateOrderStatusById(@Param("id") Integer id, @Param("isPay") Integer isPay);
    int insertOneOrderDetail(OrderDetail orderDetail);
    int insertOrderDetails(@Param("orderDetails") List<OrderDetail> orderDetails, @Param("orderId") Integer orderId);
    //删除购物车订单
    int deleteOrderById(Integer id);
    int deleteOrderDetailByOrderId(Integer orderId);
}
